//
//  AppMacroTestCase.m
//  iOSToolkit-OC
//
//  Created by Evan Xie on 8/3/15.
//  Copyright (c) 2015 Family Wings. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "AppMacro.h"


@interface AppMacroTestCase : XCTestCase

@end

@implementation AppMacroTestCase

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testAppVersion {
    NSString *appBuildNumber = AMAppBuild;
    NSString *appShortVersion = AMAppShortVersion;
    NSString *appVersion = AMAppVersion;
    
    XCTAssertTrue(appBuildNumber.length > 0, @"App build number is empty!");
    XCTAssertTrue(appShortVersion.length > 0, @"App short version is empty!");
    XCTAssertTrue(appVersion.length > 0, @"App version is empty");
}

- (void)testDeviceInfo
{
    XCTAssertTrue(AMDeviceModel.length > 0, @"Can not get iOS device model.");
    XCTAssertTrue(AMDeviceName.length > 0, @"Can not get iOS device name.");
    XCTAssertTrue(AMDeviceOSVersion.length > 0, @"Can not get iOS device system version.");
}

- (void)testAppSandbox
{
    XCTAssertTrue([AMDirectoryApplicationSupport length] > 0, @"Can not get /ApplicationSupport directory");
    XCTAssertTrue([AMDirectoryCaches length] > 0, @"Can not get /Caches directory");
    XCTAssertTrue([AMDirectoryDocuments length] > 0, @"Can not get /Documents directory");
    XCTAssertTrue([AMDirectoryLibrary length] > 0, @"Can not get /Library directory");
    XCTAssertTrue(AMDirectoryTemp.length > 0, @"Can not get /temp directory");
}

- (void)testSingletonInstance
{
    XCTAssertFalse(AMApplication == nil, @"Can not get UIApplication");
    XCTAssertFalse(AMFileManager == nil, @"Can not get NSFileManager");
    XCTAssertFalse(AMNotificationCenter == nil, @"Can not get NSNotificationCenter");
    XCTAssertFalse(AMUserDefaults == nil, @"Can not get NSUserDefaults");
}

- (void)testColor
{
    XCTAssert(AMUIColorFromRGB(200, 100, 70) != nil, @"Failed to create UIColor object from R, G, B values");
    XCTAssert(AMUIColorFromRGBA(200, 100, 70, 0.5) != nil, @"Failed to create UIColor object from R, G, B, A values");
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end
